Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
git-repo-info
Advanced tools
The git-repo-info npm package provides a simple way to gather information about a Git repository. It can be used to retrieve details such as the current branch, the latest commit hash, and other repository metadata.
Get Current Branch
This feature allows you to get the current branch name of the Git repository.
const gitRepoInfo = require('git-repo-info');
const info = gitRepoInfo();
console.log(info.branch);
Get Latest Commit Hash
This feature allows you to get the latest commit hash of the Git repository.
const gitRepoInfo = require('git-repo-info');
const info = gitRepoInfo();
console.log(info.sha);
Get Repository Root
This feature allows you to get the root directory of the Git repository.
const gitRepoInfo = require('git-repo-info');
const info = gitRepoInfo();
console.log(info.root);
Get Committer Date
This feature allows you to get the committer date of the latest commit in the Git repository.
const gitRepoInfo = require('git-repo-info');
const info = gitRepoInfo();
console.log(info.committerDate);
simple-git is a lightweight interface for running Git commands in any node.js application. It provides a more comprehensive set of Git functionalities compared to git-repo-info, including the ability to execute various Git commands programmatically.
nodegit is a native Node.js library that provides a high-level API for interacting with Git repositories. It offers extensive Git functionalities, including repository management, commit history, and branch operations, making it more feature-rich than git-repo-info.
isomorphic-git is a pure JavaScript implementation of Git that works in both Node.js and browser environments. It provides a wide range of Git functionalities, including cloning, committing, and pushing, making it a versatile alternative to git-repo-info.
Retrieves repo information without relying on the git
command.
var getRepoInfo = require('git-repo-info');
var info = getRepoInfo();
info.branch //=> will be the current branch
info.sha //=> will be the current sha
info.abbreviatedSha //=> will be the first 10 chars of the current sha
info.tag //=> will be the tag for the current sha (or `null` if no tag exists)
info.committer //=> will be the committer for the current sha
info.committerDate //=> will be the commit date for the current sha
info.author //=> will be the author for the current sha
info.authorDate //=> will be the authored date for the current sha
info.commitMessage //=> will be the commit message for the current sha
When called without any arguments, git-repo-info
will automatically lookup upwards
into parent directories to find the first match with a .git
folder.
If passed an argument, it will be assumed to be the path to the repo's .git
folder
to inspect.
FAQs
Retrieve current sha and branch name from a git repo.
The npm package git-repo-info receives a total of 677,178 weekly downloads. As such, git-repo-info popularity was classified as popular.
We found that git-repo-info demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.